package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsRoleMapper;
import com.qf.pojo.DtsRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Service
public class RoleServiceImpl implements RoleService{
  @Autowired
  private DtsRoleMapper dtsRoleMapper;
   @Override
    public Set<String> queryRolesByIds(Integer[] roleIds) {
       QueryWrapper<DtsRole> queryWrapper = new QueryWrapper<>();
       queryWrapper.in("id",roleIds);
       List<DtsRole> roles = dtsRoleMapper.selectList(queryWrapper);
       Set<String> roleSet = new HashSet<>();
       for (DtsRole role : roles) {
           roleSet.add(role.getName());
       }
       return roleSet;
    }
}
